"""
    数据库
"""
# 数据库配置信息 
DB_USERNAME = 'root'
DB_PASSWORD = 'root'
DB_HOST = 'localhost'
DB_PORT = 3306
DB_NAME = 'forum'

# 数据库连接URI
DB_URI = f'mysql+pymysql://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}?charset=utf8'

# SQLAlchemy配置
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_TRACK_MODIFICATIONS = False  # 关闭对模型修改的监控

'''
    邮箱配置
    密钥：sgukbzteqnqbdice
'''
MAIL_SERVER = 'smtp.qq.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = '2407992583@qq.com'
MAIL_PASSWORD = "sgukbzteqnqbdice"
MAIL_DEFAULT_SENDER = '2407992583@qq.com'

'''
    Celery的redis配置
'''
CELERY_BROKER_URL = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"

'''
    Flask-Caching 的配置
'''
CACHE_TYPE = 'RedisCache'
CACHE_DEFAULT_TIMEOUT = 300
CACHE_REDIS_HOST = '127.0.0.1'
CACHE_REDIS_PORT = 6379

'''
    token
'''
SECRET_KEY = "qwdfvbhgtrew123rth"
'''
    图像验证
'''
import os

BASE_DIR = os.path.dirname(__file__)


'''
    cookie
'''
from datetime import timedelta

PERMANENT_SESSION_LIFETIME = timedelta(days=7)

'''
    头像配置
'''
AVATARS_SAVE_PATH = os.path.join(BASE_DIR, 'media', 'avatars')

'''
帖子图片存放路径
'''
POST_IMAGE_SAVE_PATH = os.path.join(BASE_DIR, 'media', 'post')

'''
每页展示帖子数量
'''
PER_PAGE_COUNT = 10

'''
设置JWT过期时间
'''
JWT_ACCESS_TOKEN_EXPIRES = timedelta(days=7)

'''
帖子图片存放路径
'''
BANNER_IMAGE_SAVE_PATH = os.path.join(BASE_DIR, 'media', 'banner')

# JWT_TOKEN_LOCATION = ['headers', 'query_string']
